﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.App.Application;
using Traceability.App.Application.Dto.Input;
using Traceability.App.Application.Dto.Output;
using Traceability.App.ErrorCode;

namespace Traceability.App.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SlaughterhouseController : ControllerBase
    {
        private readonly IService service;
        public SlaughterhouseController(IService service)
        {
            this.service = service;
        }
        /// <summary>
        /// 添加/修改深加工信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<int> AddSlaughterhouse(SlaughterhouseInput input) 
        {
            return service.AddSlaughterhouse(input);
        }
        /// <summary>
        /// 获取深加工信息
        /// </summary>
        /// <param name="batch"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<SlaughterhouseOutput> GetSlaughterhouseShow(string batch) 
        {
            return service.GetSlaughterhouseShow(batch);
        }

        /// <summary>
        /// 添加/修改深加工企业信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<int> AddSlaughterhouseTable(SlaughterhouseTableInput input) 
        {
            return service.AddSlaughterhouseTable(input);
        }

        /// <summary>
        /// 获取深加工信息
        /// </summary>
        /// <param name="batch"></param>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<SlaughterhouseTableOutput> GetSlaughterhouseTableShow(string batch) 
        {
            return service.GetSlaughterhouseTableShow(batch);
        }
    }
}
